package com.view;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@SuppressWarnings("serial")
public class LogOutServlet extends HttpServlet{

	public void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		HttpSession session = req.getSession(true);
		session.invalidate();
		/*String[] refererPath = req.getHeader("referer").split("/");
		int refererPathLength = refererPath.length;
		String redirectPath = refererPathLength > 0 ? refererPath[refererPathLength-1] : "/index.jsp";
		resp.sendRedirect(redirectPath);*/
		resp.sendRedirect("/index.jsp");
	}
	
	public void doGet(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		doPost(req,resp);
	}
}